import re


class demo():
    
    def __init__(self,initval = None, name = "var"):
        self.val = initval
        self.name = name
        
    def __get__(self,obj,objtype):
        print("Getting",self.name)
        print("self.val:",self.val)
        return self.val
    
    def __set__(self,obj,val):
        print("Updating",self.name)
        self.val = val
        print("self.val:",self.val)
        return self.val
    
class test:
    x = demo(10,'var x')
    y = 20
    
t = test()
# print(t.x)
t.x = demo(100, "var x")
print(t.x)